#include <stdlib.h>
#include <stdio.h>
#include <nds.h>

// common headers
#include "common.h"

// local headers

#include "main.h"

#define _VERSION_INT MAKE_VERSION(0, 0, 1, STATE_NORMAL, 0)
char _VERSION_STR[VERSION_STR_MAX_LEN+1];

int init() {	// returning 1 in this function doesn't call the deinit functions !
	std->sprintf(_VERSION_STR, VERSION_FORMAT, VERSION_ARGS(_VERSION_INT));	// make version str

	std->iprintf("\x1b[2J");	// clear screen
	std->iprintf("[pluginhello]init\n");

	return 0;
}

u32 query(u32 query) {
	std->iprintf("[pluginhello]query(%d)\n", query);

	switch(query) {
	case QUERY_NAME:		// plugin name
		return (u32)"hello world";
	case QUERY_VERSION_INT:	// plugin integer version
		return (u32)_VERSION_INT;
	case QUERY_VERSION_STR:	// plugin string version
		return (u32)_VERSION_STR;
	case QUERY_AUTHOR:		// plugin author
		return (u32)"Ludo6431";
	case QUERY_FILEEXT:		// plugin file extension handled
		return (u32)NULL;
	default:
		return 0;
	}
}

int main(int argc, char *argv[]) {
	std->iprintf("[pluginhello]Hello World !\n");

	return 0;
}

void deinit() {
	std->iprintf("[pluginhello]deinit\n");
}

